package com.zzz.web;

import com.zzz.common.SpringSecurityUtil;
import com.zzz.dao.UserDao;
import com.zzz.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @author Chunsheng.Zhang
 * @date 2021/5/11 17:37
 * @description : TODO
 */
@RequestMapping("/user")
@RestController
public class UserController {

    @Autowired
    private UserDao userDao;


    @RequestMapping("/getUser")
    public User getUser(HttpSession session){

        return userDao.selByUsername(SpringSecurityUtil.currentUser(session));
    }



    @RequestMapping("/hello")
    public String hello(){

        return "资源访问成功！";
    }

}
